<#ibiztemplate>
TARGET=PSSYSTEMDBCFG
</#ibiztemplate>

<#macro buildCond cond>
<#if cond.getCondType()=='GROUP'>
<#if cond.getChildDEDataQueryConds()??>
<#if !srfemptylist(cond.getChildDEDataQueryConds())>
(<#list cond.getChildDEDataQueryConds() as childcond><#if childcond_index gt 0 >${cond.getCondOp()} </#if><@buildCond cond=childcond /></#list>)
</#if>
</#if>
<#elseif cond.getCondType()=='DEFIELD'>
${cond.getDEFieldExp()} ${cond.getCondOp()} ${cond.getCondValue()}
<#elseif cond.getCondType()=='CUSTOM'>
${cond.getCustomCond()} 
</#if>
</#macro>

<#list sys.getAllPSDataEntities() as entity>
<#if !entity.getPSSystemModule().isSubSysModule()>
# **${entity.getLogicName()}**(${entity.getName()})

<#if entity.getAllPSDEDataQueries()??>
<#if srfemptylist(entity.getAllPSDEDataQueries())>
无
<#else>
<#list entity.getAllPSDEDataQueries() as dequery>
### <#if dequery.getLogicName()?default("")?trim?length gt 1>${dequery.getLogicName()}<#else>${dequery.getName()}</#if>(${dequery.getName()})<div id="${entity.getCodeName()}_${dequery.getCodeName()}"></div>
<#if dequery.getPSDEDataQueryCode(item.getDBType())??>
<#assign querycode=dequery.getPSDEDataQueryCode(item.getDBType())>
```sql
${querycode.getQueryCode()}
<#if querycode.	getPSDEDataQueryCodeConds()??>
<#if !srfemptylist(querycode.getPSDEDataQueryCodeConds())>
WHERE <#list querycode.getPSDEDataQueryCodeConds() as cond><@buildCond cond=cond /></#list>
</#if>
</#if>
```
</#if>
</#list>
</#if>
</#if>

</#if>
</#list>